/*
 * NaryRule.java
 *
 * Created on July 13, 2006, 4:54 PM
 *
 */

package galronnlp.pcfg.grammar;

import galronnlp.util.Symbol;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Daniel A. Galron
 */
public class NaryRule implements Rule{

    private final int arity;
    private LinkedList<Symbol> RHS;
    private Symbol LHS;
    private double probability;    
    
    /** Creates a new instance of NaryRule */
    public NaryRule(Symbol LHS, LinkedList<Symbol> RHS, double probability) {
        this.LHS = LHS;
        this.RHS = RHS;
        this.probability = probability;
        this.arity = RHS.size();
    }

    public double prob() {
        return this.probability;
    }

    public double logProb() {
        return java.lang.Math.log(probability);
    }

    public int arity() {
        return arity;
    }

    public Symbol LHS() {
        return this.LHS;
    }

    public List<Symbol> RHS() {
        return this.RHS;
    }

    public boolean hasTerminalRHS() {
        return false;
    }
    
}
